import { http } from '@/utils/axios/init'
let prefix = '/ctms/Rest/sop'
//查询分页列表
export function getFileListByPage(data) {
  return http.request(
    {
      url: `${prefix}/fileList/listByPage`,
      method: 'get',
      params: data
    },
    {
      // isMock: true
    }
  )
}
//查询列表
export function getFileList(data) {
  return http.request(
    {
      url: `${prefix}/fileList/list`,
      method: 'get',
      params: data
    },
    {
      // isMock: true
    }
  )
}
//查询启用文件清单列表
export function queryEnableList(params) {
  return http.request({
    url: `${prefix}/fileList/queryEnableList`,
    method: 'get',
    params
  })
}

//查询文件清单详情
export function getFileItemList(data) {
  return http.request(
    {
      url: `${prefix}/fileList/getById`,
      method: 'get',
      params: data
    },
    {
      // isMock: true
    }
  )
}
//新增文件清单(运维端)
export function saveFileList(data) {
  return http.request(
    {
      url: `${prefix}/fileList/save`,
      method: 'post',
      params: data
    },
    {
      // isMock: true
      successMessageText: '新增成功'
    }
  )
}
//新增文件清单(SOP)
export function saveForSop(data) {
  return http.request(
    {
      url: `${prefix}/fileList/saveForSop`,
      method: 'post',
      params: data
    },
    {
      // isMock: true
      successMessageText: '新增成功'
    }
  )
}

//编辑文件清单
export function updateFileList(data) {
  return http.request(
    {
      url: `${prefix}/fileList/update`,
      method: 'post',
      params: data
    },
    {
      // isMock: true
      successMessageText: '操作成功'
    }
  )
}
//复制文件清单
export function copyFileList(data) {
  return http.request(
    {
      url: `${prefix}/fileList/copy`,
      method: 'post',
      params: data
    },
    {
      // isMock: true
      joinParamsToUrl: true,
      successMessageText: '操作成功'
    }
  )
}
//删除文件清单
export function deleteFileList(data) {
  return http.request(
    {
      url: `${prefix}/fileList/delete`,
      method: 'post',
      params: data
    },
    {
      // isMock: true
      joinParamsToUrl: true,
      successMessageText: '操作成功'
    }
  )
}
//修改文件清单状态
export function updateStatus(data) {
  return http.request(
    {
      url: `${prefix}/fileList/updateStatus`,
      method: 'post',
      params: data
    },
    {
      // isMock: true
      successMessageText: '操作成功'
    }
  )
}
// 项目级-进度-文件清单  选择文件清单模板
export function pitchOn(params) {
  return http.request(
    {
      url: `/ctms/Rest/projectFileListItem/pitchOn`,
      method: 'post',
      params
    },
    {
      joinParamsToUrl: true,
      successMessageText: '操作成功'
    }
  )
}

// SOP-进度模板-选择文件清单
export function sopPitchOn(params) {
  return http.request(
    {
      url: `/ctms/Rest/sop/taskFileListItem/pitchOn`,
      method: 'post',
      params
    },
    {
      joinParamsToUrl: true,
      successMessageText: '操作成功'
    }
  )
}
// 项目级-进度-文件清单  批量新增文件清单（使用空白模板）
export function batchSave(params) {
  return http.request(
    {
      url: `/ctms/Rest/projectFileListItem/batchSave`,
      method: 'post',
      params
    },
    {
      // joinParamsToUrl: true,
      successMessageText: '操作成功'
    }
  )
}

// SOP-进度-文件清单  批量新增文件清单（使用空白模板）
export function sopBatchSave(params) {
  return http.request(
    {
      url: `/ctms/Rest/sop/taskFileListItem/batchSave`,
      method: 'post',
      params
    },
    {
      // joinParamsToUrl: true,
      successMessageText: '操作成功'
    }
  )
}

// 项目级-进度-文件清单 查询当前任务下文件清单列表
export function getFileListByTask(params) {
  return http.request({
    url: `/ctms/Rest/projectFileListItem/list`,
    method: 'get',
    params
  })
}

// SOP-进度-文件清单 查询当前任务下文件清单列表
export function getSopFileListByTask(params) {
  return http.request({
    url: `/ctms/Rest/sop/taskFileListItem/list`,
    method: 'get',
    params
  })
}

// 项目级-进度-文件清单 新增文件清单
export function saveProjectFile(params) {
  return http.request(
    {
      url: `/ctms/Rest/projectFileListItem/save`,
      method: 'post',
      params
    },
    {
      successMessageText: '新增成功'
    }
  )
}
// sop-进度-文件清单 新增文件清单
export function sopSaveProjectFile(params) {
  return http.request(
    {
      url: `/ctms/Rest/sop/taskFileListItem/save`,
      method: 'post',
      params
    },
    {
      successMessageText: '新增成功'
    }
  )
}
// 项目级-进度-文件清单 编辑文件清单
export function updateProjectFile(params) {
  return http.request(
    {
      url: `/ctms/Rest/projectFileListItem/update`,
      method: 'post',
      params
    },
    {
      successMessageText: '操作成功'
    }
  )
}
// SOP-进度-文件清单 编辑文件清单
export function sopUpdateProjectFile(params) {
  return http.request(
    {
      url: `/ctms/Rest/sop/taskFileListItem/update`,
      method: 'post',
      params
    },
    {
      successMessageText: '操作成功'
    }
  )
}
// 项目级-进度-文件清单 删除文件清单
export function deleteProjectFile(params) {
  return http.request(
    {
      url: `/ctms/Rest/projectFileListItem/delete`,
      method: 'post',
      params
    },
    {
      joinParamsToUrl: true,
      successMessageText: '删除成功'
    }
  )
}
// sop-进度-文件清单 删除文件清单
export function sopDeleteProjectFile(params) {
  return http.request(
    {
      url: `/ctms/Rest/sop/taskFileListItem/delete`,
      method: 'post',
      params
    },
    {
      joinParamsToUrl: true,
      successMessageText: '删除成功'
    }
  )
}

// 项目级-进度-文件清单 修改文件清单顺序
export function editDisplayOrder(params) {
  return http.request(
    {
      url: `/ctms/Rest/projectFileListItem/editDisplayOrder`,
      method: 'post',
      params
    },
    {
      // joinParamsToUrl: true,
      successMessageText: '操作成功'
    }
  )
}
// sop-进度-文件清单 修改文件清单顺序
export function sopEditDisplayOrder(params) {
  return http.request(
    {
      url: `/ctms/Rest/sop/taskFileListItem/editDisplayOrder`,
      method: 'post',
      params
    },
    {
      // joinParamsToUrl: true,
      successMessageText: '操作成功'
    }
  )
}

// 项目级-进度-文件清单 修改文件清单顺序
export function getTaskFileDetailList(params) {
  return http.request({
    url: `/ctms/Rest/projectFileListItem/detailList`,
    method: 'get',
    params
  })
}
